package com.ebupt.migu.music.tapi;

import com.ebupt.migu.common.util.RedisLock;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author liuyangyang@e-byte.com
 * @description: TODO
 * @date 2024/3/30 8:12
 */
@Slf4j
@Component
@EnableScheduling
public class TestScheduleController {
    @Autowired
    RedisTemplate redisTemplate;

//    @Scheduled(initialDelay = 1000, fixedRate = 1000 * 60)
    public void run(){
        String key = "TestScheduleController";
        RedisLock redisLock = new RedisLock(redisTemplate, key);
        if (redisLock.getLock()){
            log.info("TestScheduleController start");
        }else {
            log.info("TestScheduleController wait");
        }
    }
}
